﻿using System;
namespace PrintNumsApplication
{
    class Judge {
        public static bool judge(int num)
        {
            if (num == 1) return false;
            if (num == 2) return true;
            for (int i = 2; i < num; i++) {
                if (num % i == 0) return false;
            }
            return true;
        }
    }

    class PrintNums
    {
        static void Main(string[] args) {
            Console.Write("输入两个数字：");
            string[] nums = Console.ReadLine().Split(' ');//按空格拆分字符串
            int a = int.Parse(nums[0]);//int.Parse:字符串转整数
            int b = int.Parse(nums[1]);
            int low=a < b ?a : b;
            int high=a > b ?a : b;
            Console.WriteLine($"下界{low},上界{high}");
            Console.WriteLine("期间所有素数有：");
            for (int i = low; i <= high; i++) {
                if (Judge.judge(i)) {
                    Console.Write($"{i} ");
                }
            }
        }
    }
}